package com.tjnmt.togo.utils;

import android.app.Application;
import android.content.Context;
import android.os.Handler;

import com.baidu.mapapi.SDKInitializer;

import org.xutils.x;

import cn.jpush.android.api.JPushInterface;

/**
 * 全局获得context的工具类。
 */
public class ApplicationUtils extends Application {
    private static Context context;
    private static Handler handler;
    private static int mainThreadId;

    @Override
    public void onCreate() {

        super.onCreate();
        //路线检索等鹰眼之外的sdk初始化。
        SDKInitializer.initialize(getApplicationContext());

        x.Ext.init(this);
        //开发阶段,设置打印日志。
        x.Ext.setDebug(true);

        JPushInterface.setDebugMode(true);
        JPushInterface.init(this);

        context = getApplicationContext();
        handler = new Handler();
        mainThreadId = android.os.Process.myTid();
    }

    public static Context getContext() {
        return context;
    }

    public static Handler getHandler() {
        return handler;
    }

    public static int getMainThreadId() {
        return mainThreadId;
    }
}
